from fastapi import APIRouter
from app.schemas.system.copywriting import GenerateRequest
from app.utils.request import RequestHandler

from app.services.system.copywriting_service import CopywritingService

router = APIRouter()
copywriting_service = CopywritingService()

@router.post("/generate", response_model= None)
async def generate_copywriting(request: GenerateRequest):
    """生成文案接口"""
    try:
        copywritings = await copywriting_service.generate_copywriting(request)
        return RequestHandler.success(
            data=copywritings,
            message="文案生成成功",
            remarks="成功"

        )
    except Exception as e:
        print(f"文案生成错误: {str(e)}")
        raise RequestHandler.server_error(message=f"文案生成失败: {str(e)}")

@router.get("/types")
async def get_content_types():
    """获取文案类型列表"""
    return RequestHandler.success(
        data= [
            {"value": "daily", "label": "日常生活", "description": "记录生活中的小美好"},
            {"value": "mood", "label": "心情感悟", "description": "表达内心的感受"},
            {"value": "food", "label": "美食分享", "description": "分享美食的快乐"},
            {"value": "travel", "label": "旅行记录", "description": "记录旅途的风景"},
            {"value": "work", "label": "工作感悟", "description": "职场生活的思考"},
            {"value": "love", "label": "情感表达", "description": "爱情与友情的记录"},
            {"value": "inspiration", "label": "励志正能量", "description": "传递积极向上的力量"}
        ],
        remarks="成功"
    )

@router.get("/styles")
async def get_content_styles():
    """获取文案风格列表"""
    return RequestHandler.success(
        data = [
            {"value": "warm", "label": "温暖治愈", "description": "温馨暖心的表达"},
            {"value": "humor", "label": "幽默风趣", "description": "轻松有趣的语调"},
            {"value": "literary", "label": "文艺清新", "description": "文艺范儿的表达"},
            {"value": "simple", "label": "简约自然", "description": "简单朴实的语言"},
            {"value": "elegant", "label": "优雅精致", "description": "高雅有品味的表达"},
            {"value": "poetic", "label": "诗意浪漫", "description": "富有诗意的语言"}
        ],
        remarks="成功"
    )